<template>
  <div>
    <h2>这是二级路由page2下的页面</h2>
    <ul>
      <li>
        <router-link to="/page2/one"> page2.1 </router-link>
      </li>
      <li>
        <router-link to="/page2/two"> page2.2 </router-link>
      </li>
      <li>
        <router-link to="/page2/three"> page2.3 </router-link>
      </li>
    </ul>
    <br>
    <button @click="btn">随机显示</button>
    <span></span>
    <router-view></router-view>
  </div>
</template>
 
<script>
export default {
  data() {
    return {
      hrefArr: ['/page2/one', '/page2/two', '/page2/three']
    }
  },
  methods: {
    btn() {
      const index = Math.floor(Math.random() * this.hrefArr.length)
      console.log(index)
      this.$router.push({
        path: this.hrefArr[index]
      })
    }
  }
}
</script>

<style scoped>
</style>